﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Tradex;
using Tradex.Market;
using Tradex.Trading;

namespace Tradex.Connectivity.ConnectorModel {

    /// <summary>
    /// The IMarketConnector interface is implemented by a connector that can handle market update information,
    /// i.e. instrument information and price streams.
    /// </summary>
    public interface IMarketConnector {

        /// <summary>
        /// This registers the IMarketConnector callback interface with the connector.
        /// </summary>
        /// <param name="callback"></param>
        void SetCallback(
            IMarketConnectorCallback callback
        );

        /// <summary>
        /// Subscribes to all data from an instrument. The filter parameter filters the data.
        /// To cancel the subscrition of that individual instrument, set the Filter to ActivityFilter.None
        /// Instrument and market subscriptions can coexist - the resulted reports will be all updates that are
        /// valid for any subscription.
        /// A subscription can be changed (so it is not necessary to cancel a subscription first), but no
        /// guarantee is made that data is lost (as: the connector may have to close and resubscribe). On any
        /// subscription request, a historical data set with all available last acitivty data should be sent.
        /// Any request for a subscription of a specific instrument that is not a 0-filter should be preceded with
        /// a call to GetReferenceData to ensure the proper current reference data is loaded.
        /// </summary>
        /// <param name="instrument"></param>
        /// <param name="filter"></param>
        void Subscribe (
            InstrumentKey instrument, ActivityFilters filter
        );

        /// <summary>
        /// Subscribes to all data from an exchange. The filter parameter filters the data.
        /// To cancel the subscrition of that exchange, set the Filter to ActivityFilter.None
        /// Instrument and market subscriptions can coexist - the resulted reports will be all updates that are
        /// valid for any subscription.
        /// It is valid to change a market subscription, but no guarantee is made that no data is lost (as the underlying
        /// API may have to close and resubscribe). Contrary to instrument subscriptions, no historical data items
        /// are to be delivered.
        /// </summary>
        /// <param name="market"></param>
        /// <param name="filter"></param>
        void Subscribe (
            MarketKey market, ActivityFilters filter
        );

        /// <summary>
        /// Requests reference data for a specific instrument.
        /// </summary>
        /// <param name="instrument"></param>
        void GetReferenceData(
            InstrumentKey instrument
        );

    }

}
